package com.cg.service.Impl;

import com.cg.entity.Events;
import com.cg.mapper.EventsMapper;
import com.cg.service.EventsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EventsServiceImpl implements EventsService {
    @Autowired
    EventsMapper eventsMapper ;
    @Override
    public List<Events> eventsList(Integer userId, Integer categoryId, String title, Integer priority, Integer status) {
        return eventsMapper.eventsList(userId,categoryId,title,priority,  status);
    }

    @Override
    public void addevent(Integer userId, String title, Integer categoryId, String startDate, Integer priority, String endDate, Integer status, String description) {
        eventsMapper.addevent(userId,title,categoryId,startDate,priority,endDate,status,description);
    }

    @Override
    public Events findEventById(Integer eventId) {
        return eventsMapper.findEventById(eventId);
    }

    @Override
    public void editEvent(String title, Integer categoryId, String startDate, Integer priority, String endDate, Integer status, String description,Integer eventId) {
        eventsMapper.editEvent(title,categoryId,startDate,priority,endDate,status,description,eventId);
    }

    @Override
    public void deleteEvent(Integer eventId) {
        eventsMapper.deleteEvent(eventId);
    }

    @Override
    public int findByCategoryId(Integer categoryId) {
        return eventsMapper.findByCategoryId(categoryId);
    }
    @Override
    public int findByTitle(String title,Integer userId) {
        return eventsMapper.findByTitle(title,userId);
    }


}
